#@DESC:
#@TODO:
class GroundStructure:
  pass
  
#@DESC:
#@TODO:
class Unit:
  def __init__(self,type,name,ammo1,ammo2,morale,expirience):
    self.type = type
    self.name = name
    self.attack1 = None
    self.attack2 = None
    self.ammo1 = 0
    self.ammo2 = 0
    self.morale = morale
    self.expirience = expirience
    self.unit_state = ''
    
#@DESC:
#@TODO:  
class Squad:
  def __init__(self,name,type_name,icon):
    self.icon = icon
    self.units = []
    self.abilities = {}
    self.name = 'name'
    self.type = type_name
    self.attachments = []
    self.orders = []
    self.attack_order = 'fire_at_will'
    self.targets = []
    self.order_status ='awaiting'
    self.fatigue = 1.0
    self.path = []
    self.subposition = 0
    self.morale = 7# 0 - surrendering 1 - flee 2 - panicing 3 - broken 4 - pinned down 5-scared 6-fear 7-normal 8-combat spirit 9-heroic 10-berserk
    self.status = 'normal'
    self.comm_link = 'active'
    self.motorized_state = 'non motorized'
    self.commander = 'none'
    self.infantry_defense = 0.0
    self.armor_defense = 0.0
    self.bound_squad = None
    
    
  def getMoraleString(self):
    if self.morale == 0:
      return 'surrendering'
    elif self.morale == 1:
      return 'flee'
    elif self.morale == 2:
      return 'panic'
    elif self.morale == 3:
      return 'broken'
    elif self.morale == 4:
      return 'pinned down'
    elif self.morale == 5:
      return 'supressed'
    elif self.morale == 6:
      return 'caution'
    elif self.morale == 7:
      return 'normal'
    elif self.morale == 8:
      return 'combat'
    elif self.morale == 9:
      return 'heroic'
    elif self.morale == 10:
      return 'berserk'
        
  
  def completeLastOrder(self):
    if len(self.orders)>1:
      self.orders = self.orders[1:]
      self.order_status = 'starting'
    else:
      self.orders = []
      self.order_status = 'awaiting'
